<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>  
{*include file="template/admin_head_plugin.htm"*}
<script type="text/javascript">
$(function(){	
	var areas = "{*$smarty.get.areas*}";
	var id = "{*$smarty.get.id*}";	
	var areas_arr = areas.split(',');
	$.each(areas_arr,function(k,value){		
		$("#province_"+value).attr("checked", true);													
	});
	
	
	//$("#add_item input",window.parent.document).eq(id).val("11323333")
	/*$(window.parent.document).find("#areas1").val("90000,100000");
	$(window.parent.document).find("#areas_info1").html("安徽、江苏、上海‘北京安徽、江苏、上海江苏、上海'北京安徽、江苏、上海'北京");
	
	my_close();*/
	
	 $("#checkall").toggle(
		  function(){
			  select_all("idlist[]",true);
		  },
		  function(){
			  select_all("idlist[]",false);
		  }
	  );
	
	
	$(".Group").click(function(){
		var areas = $(this).val();	
		var areas_arr = areas.split(',');		
		if($(this).is(':checked') == true){//如果全选中
			var  is_checked = true;
		}else{
			var  is_checked = false;
		}
		
		$.each(areas_arr,function(k,value){				
			$("#province_"+value).attr("checked", is_checked);													
		});
			
	});	
	$("#confirm").click(function(){
			var goods_str = '';			
		   $("input[name='idlist[]']:checked").each(function(){  
                 goods_str += '<tr><td><input type="checkbox" name="goods_id[]" checked="checked" value="'+$(this).val()+'"><label style="font-weight:bold;">'+$(this).next().text()+'</label></td></tr>';
				 
				 
           });
		
			$("#goods_list",window.parent.document).prepend(goods_str);
			
			my_close();
				
	});
	
})
</script>

</head>
<body style="background: none repeat scroll 0pt 0pt transparent;">
<table width="100%" class="tbl tbl_nbr"> 
	{*foreach $data as $v*}
    <tr  onmouseout="this.style.backgroundColor='#ffF'" onmouseover="this.style.backgroundColor='#ffC'">
      <td width="16%">
          <input class="Group" type="checkbox" name="idlist[]" value="{*$v['goods_id']*}">
          <label style="font-weight:bold;">{*$v['goods_name']*}</label>
      </td>
    </tr>
    {*/foreach*} 
        
    <tr>
      <td align="center"><input type="button" name="checkall" id="checkall" class="myinput" value="全 选" /><input type="button" id="confirm" value="确定" onclick="" class="myinput" /></td>
    </tr>      
</table>
</body>
</html>